<template>
  <div class="restaurantCard">
    <!-- 左边图片 -->
    <div class="left">
      <img :src="img" alt="" />
    </div>
    <!-- 右边内容 -->
    <div class="right">
      <!-- 标题部分 -->
      <div class="title">
        <van-tag type="primary" size="large " color="#ffd930" text-color="#000"
          >品牌</van-tag
        >
        <span class="bigTitle"> {{ obj.name }} </span>
        <div class="iconText">
          <span>保</span>
          <span>准</span>
          <span>票</span>
        </div>
      </div>
      <!-- 内容部分 -->
      <div class="content">
        <!-- 评分 -->
        <van-rate
          v-model="value"
          :size="25"
          color="#ff9a0d"
          void-icon="star"
          void-color="#eee"
          allow-half
        />
        <span class="number"> {{ obj.rating }} </span>
        <span class="sale">月销 {{ obj.rating_count }} 单</span>
        <div class="tag">
          <van-tag type="primary" size="medium">蜂鸟专送</van-tag>
          <van-tag type="primary" plain size="medium">准时达</van-tag>
        </div>
      </div>
      <div class="info">
        <span>¥20起送 / {{ obj.piecewise_agent_fee.tips }}</span>
        <span
          >10公里 /
          <span class="spanright" style="color: #36a0ed">40分钟</span></span
        >
      </div>
    </div>
  </div>
</template>

<script>
import axios from "@/utils/request.js";
export default {
  props: ["obj"],
  data() {
    return {
      value: this.obj.rating,
      img: axios.defaults.baseURL + "/img/" + this.obj.image_path,
    };
  },
};
</script>

<style lang="less" scoped>
.restaurantCard {
  //   height: 200px;
  display: flex;
  //   background-color: yellow;
  margin: 0 10px;
  padding: 20px 0;
  border: 1px solid #ccc;
  &/deep/.left {
    height: 150px;
    width: 150px;
    img {
      width: 100%;
    }
  }
  &/deep/.right {
    width: 100%;
    margin-left: 20px;
    position: relative;
    .title {
      .bigTitle {
        margin-left: 5px;
        font-size: 22px;
        font-weight: 700;
      }

      .iconText {
        position: absolute;
        top: 5px;
        right: 20px;
        span {
          margin: 0 5px;
          color: rgb(158, 154, 154);
        }
      }
    }
    .content {
      position: relative;

      width: 100%;
      //   position: relative;
      margin: 30px 0;

      .number {
        display: inline-block;
        margin-left: 10px;
        color: red;
        font-size: 18px;
      }
      .sale {
        display: inline-block;
        margin-left: 10px;
        color: rgb(148, 147, 147);
      }
      .tag {
        position: absolute;
        right: 10px;
        top: 10px;
        span {
          margin-right: 10px;
        }
      }
    }
    .info {
      display: flex;
      justify-content: space-between;
      width: 100%;
      span {
        color: rgb(145, 145, 145);
        .spanright {
          margin-right: 20px;
        }
      }
    }
  }
}
</style>